Debugging targets

On Windows NT/95, you can use the Java Debugger and the MSDevStudio integration for debugging.
On Unix, do the following:
Choosing a debugger adaptor
To choose a debugger adaptor:

Choose the Preferences command from any open SNiFF+ tool.
The Preferences dialog appears.
Select the Platform node.

In the Platform view

From the Platform list, select the platform on which you debug.
Select the Debugger tab.
The Platform Settings dialog appears.
From the Adaptor drop-down menu, choose the debugger adaptor for your debugger.
Press Ok to apply and save your Preferences.

Debugging
To debug targets:

Choose the Debug target command in the Target menu of the Project Editor, Source Editor or the Shell.

| Note
| If the Debug target command is not enabled, either the target name is not specified in the project's Make attributes or the executable does not exist in the project directory.

You should notice two things:

- The Debugger dialog appears. For details, please refer to Debugger (Unix and Java).
- The Source Editor is now in debugging mode and a button bar with the most common debugger commands appears in it.

Execute debug commands. Either type in debug commands on the Debugger's command prompt or use the button bar in the Source Editor or select the commands in the Debugger.

Some useful debugging commands
Setting a breakpoint

- Choose the line in the Source Editor where you want to set a breakpoint.
- Press the Break At button.
A small stop sign at the beginning of the line indicates the breakpoint.

Displaying values

- Select a variable by double-clicking on it in the Source Editor.
- Press the Print button.
The Debugger displays the current value of the variable.

Single-stepping
There are two possibilities for single-stepping:

- Next steps over functions and methods.
- Step steps into functions and methods.

Showing the call hierarchy

- Press the Stack button in the Source Editor or select the Callstack tab in the Debugger.
The call chain is displayed.

Quitting the Debugger

- Choose Close Tool from the Tools menu.
The Debugger closes. The button line with debugging commands is removed from the Source Editor after the Debugger quits.

Source Editor in debugging mode
When the Source Editor is in debugging mode, all files loaded in it are read-only and a row of new buttons is added to the tool.

Command | Description
Run | Runs the application being debugged from scratch.
Cont | Continues interrupted execution.
Step | Single-steps into the next function/method.
Next | Single-steps over the next function/method.
Break In | Sets a break point at the first execution line of a selected function/method.
Break At | Sets a breakpoint at the current cursor position.
Clear | Clears the breakpoint in the current line. The cursor must be positioned to a line with a breakpoint.
Print * | Prints the value pointed to by the current selection. The selection must evaluate to a valid pointer.
Print | Prints the value of the current selection. The selection must evaluate to a valid variable.
this | Prints the value of the current object.
Stack | Displays the current call stack.
Up | Goes one stack frame up in the call hierarchy. A reusable Source Editor is automatically positioned at the source location of the new stack frame.
Down | Goes one stack frame down in the call hierarchy. A reusable Source Editor is automatically positioned at the source location of the new stack frame.